/*
 * @Author: your name
 * @Date: 2020-10-28 08:30:31
 * @LastEditTime: 2020-10-28 22:27:10
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \就业班练习d:\桌面\ma-pc\src\api\addArticle.js
 */

import axios from '@/utils/request.js'
/**
 * @description: 获取频道数据
 * @param {*}
 * @return {Promise}
 */
export const getChannels = (param) => {
  return axios({
    url: 'mp/v1_0/channels',
    method: 'GET',
    param
  })
}

/**
 * @description: 发布文章
 * @param {*}
 * @return {Promise}
 */
export const pubArticle = (params, data) => {
  return axios({
    url: 'mp/v1_0/articles',
    method: 'POST',
    data,
    params
  })
}
/**
 * @description: 获取指定文章
 * @param {Number} id 指定文章id
 * @return {*}
 */
export const hGetArticle = (id) => {
  return axios({
    url: 'mp/v1_0/articles/' + id,
    method: 'GET'
  })
}
/**
 * @description: 修改文章
 * @param {Number} id 指定文章id
 * @param {Boolean} params 草稿/发布  true/false
 * @return {*}
 */
export const editArticle = (id, params, data) => {
  return axios({
    url: 'mp/v1_0/articles/' + id,
    method: 'PUT',
    data,
    params
  })
}
